<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8"/>
<head>
    <meta charset="utf-8">
    <title>角色编辑</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" th:href="@{/layuiadmin/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/layuiadmin/style/admin.css}" media="all">
</head>
<body>
<div class="layui-form" style="margin: 15px;">
    <div class="layui-form-item">
        <label class="layui-form-label">角色名称：</label>
        <div class="layui-input-inline">
            <input id="roleName" name="roleName" class="layui-input" lay-verify="required" autocomplete="off"
                   type="text" th:value="${role.roleName}"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">角色描述：</label>
        <div class="layui-input-inline">
            <textarea id="remark" name="remark" th:text="${role.remark}" class="layui-textarea" lay-verify="required"
                      autocomplete="off"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">角色权限：</label>
        <div class="layui-input-block">
            <div id="menuList" lay-filter="menuList"></div>
        </div>
    </div>

    <div class="layui-form-item layui-hide">
        <div class="layui-input-inline">
            <input id="id" name="id" class="layui-input" th:value="${role.id}"/>
            <input type="button" lay-submit id="submit-btn" lay-filter="submit-btn">保存</input>
            <input type="button" id="cancel-btn">取消</input>
        </div>
    </div>
</div>
<script th:src="@{/static/layuiadmin/layui/layui.js}"></script>
<script th:src="@{/static/bm/js/common.js}"></script>
<script th:inline="javascript">
    var menuData = [[${menuData}]];
    layui.config({
        base: contextPath + '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'tree'], function () {
        var $ = layui.$
            , form = layui.form
            , tree = layui.tree;
        form.render();
        //树形菜单
        tree.render({
            elem: '#menuList'  //绑定元素
            , id: 'menuTreeList'  //绑定元素
            , showCheckbox: true
            , onlyIconControl: false
            , accordion: true
            , data: menuData
        });
    });
</script>
</body>
</html>
